package com.ssm.dboss;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.util.List;
import java.util.stream.Collectors;

public class ATest {

    public static void main(String[] args) {
        List<UserInstrumentProfitDTO> list  = new Gson().fromJson("[{\"userId\":\"41053888\",\"productId\":\"USDT\",\"instrumentId\":\"ETH-USDT\",\"profit\":0.218806362749036897,\"profitRate\":198.997493734335839598,\"volume\":59500.000000000000000000,\"direction\":1,\"leverage\":200,\"positionMode\":2,\"modeType\":2},{\"userId\":\"41076825\",\"productId\":\"ETH-USDT\",\"instrumentId\":\"ETH-USDT\",\"profit\":0.004604386165078940,\"profitRate\":2.301856172999548680,\"volume\":783.000000000000000000,\"direction\":1,\"leverage\":5,\"positionMode\":2,\"modeType\":1},{\"userId\":\"41076825\",\"productId\":\"USDT\",\"instrumentId\":\"ETH-USDT\",\"profit\":0.003563179059870768,\"profitRate\":0.353083700241594978,\"volume\":11100.000000000000000000,\"direction\":1,\"leverage\":1,\"positionMode\":2,\"modeType\":2},{\"userId\":\"12192683\",\"productId\":\"USDT\",\"instrumentId\":\"ETH-USDT\",\"profit\":0.003327607321474616,\"profitRate\":1.647869674185463659,\"volume\":10.000000000000000000,\"direction\":1,\"leverage\":5,\"positionMode\":2,\"modeType\":2},{\"userId\":\"41076240\",\"productId\":\"USDT\",\"instrumentId\":\"ETH-USDT\",\"profit\":0.002784032586637858,\"profitRate\":1.950161787333661758,\"volume\":3607.000000000000000000,\"direction\":1,\"leverage\":5,\"positionMode\":2,\"modeType\":2}]"
                , new TypeToken<List<UserInstrumentProfitDTO>>() {
                }.getType());
        list.stream().collect(Collectors.toMap(UserInstrumentProfitDTO::getUserId, UserInstrumentProfitDTO::getVolume));
    }
}
